Micron Document
🎖️GitЯра🎖️

Node / meshtastic / Meshtastic-Android / files / .github / instructions / kmp-common.instructions.md

Displaying Rendered • View rawDownload

.github/instructions/kmp-common.instructions.md renovate/kover (38f0451a) Text, 1.34 KB

applyTo: "/commonMain//*.kt"

KMP commonMain Rules

• NEVER import T383838java.* or T383838android.* in T383838commonMain.
• Use T383838org.meshtastic.core.common.util.ioDispatcher instead of T383838Dispatchers.IO.
• Use Okio (T383838BufferedSource/T383838BufferedSink) instead of T383838java.io.*.
• Use T383838kotlinx.coroutines.sync.Mutex instead of T383838java.util.concurrent.locks.*.
• Use T383838atomicfu or Mutex-guarded T383838mutableMapOf() instead of T383838ConcurrentHashMap.
• Use T383838jetbrains-* catalog aliases for lifecycle/navigation dependencies.
• Use T383838compose-multiplatform-* catalog aliases for CMP dependencies.
• Never use plain T383838androidx.compose dependencies in T383838commonMain.
• Strings: use T383838stringResource(Res.string.key) from T383838core:resources. No hardcoded strings.
• CMP T383838stringResource only supports T383838%N$s and T383838%N$d — pre-format floats with T383838NumberFormatter.format().
• Use T383838MetricFormatter from T383838core:common for display strings (temperature, voltage, percent, signal). Avoid scattered T383838formatString("%.1f°C", val) calls.
• Check T383838gradle/libs.versions.toml before adding dependencies.
• Use T383838safeCatching {} from T383838core:common instead of T383838runCatching {} in coroutine/suspend contexts. Keep T383838runCatching only in cleanup/teardown code.
• Use T383838kotlinx.coroutines.CancellationException, not T383838kotlin.coroutines.cancellation.CancellationException.

Served by rngit 1.5.2 - Generated in 0.08s